home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Animation How-To
/
Animation How-to CD.iso
/
PLY
/
CHAPTER2
/
BOLITA
/
FLAP.BAS
< prev
next >
Wrap
BASIC Source File
|
1994-01-01
|
2KB
|
67 lines
' FLAP.BAS
SCREEN 12
WINDOW (-16, -12)-(16, 12)
pi = 3.14159
rad = pi / 180
frame = -16
'Show the waveform
FOR angle = -360 TO 360 STEP 1
x = angle / 30
w = 10 * COS(angle * rad)
z = EXP(1.6 * (1 + COS((angle - 80) * rad)))
y = w + z
IF angle = -360 THEN PSET (x, y / 5) ELSE LINE -(x, y / 5)
NEXT angle
DO WHILE INKEY$ = "": LOOP
CLS
' A reference box
LINE (-4, 0)-(4, 8), , B
DO WHILE INKEY$ = "" ' go until a key is pressed
t = t + 10 ' time step size
'===================The Assymetric Waveform====================
w = 10 * COS(t * rad) ' periodic motion
z = EXP(1.6 * (1 + COS((t - 80) * rad))) ' periodic hump
phz = w + z ' add 'em together
ang = 45 + phz ' shift the phase
'===============================================================
x = 8 * COS(ang * rad)
y = 8 * SIN(ang * rad) + 2
fx = 0
fy = -4 * SIN(ang * rad) + 4
' Undraw
LINE (ofx, ofy)-(ox, oy), 0
LINE (ofx, ofy)-(-ox, oy), 0
CIRCLE (ox, oy), 1, 0
CIRCLE (-ox, oy), 1, 0
CIRCLE (ofx, ofy - .5), .5, 0
' Draw
LINE (fx, fy)-(x, y), 15 ' draw the current screen
LINE (fx, fy)-(-x, y), 15 ' draw the current screen
CIRCLE (x, y), 1, 15 ' (draw in color 15 = white)
CIRCLE (-x, y), 1, 15 ' (draw in color 15 = white)
CIRCLE (fx, fy - .5), .5, 15
' Save
ox = x ' save the current screen
oy = y ' variables (ox = old-x; oy = old-y)
ofx = fx
ofy = fy
d = ((fx - x) ^ 2 + (fy - y) ^ 2) ^ .5
PSET (frame, d), 15
PSET (frame, y), 14
frame = frame + .01
FOR w = 1 TO 1000: NEXT w
LOOP